Error processing SSI file
Leadtools.Dicom.Common

Show in webframe

Process Method






The item to be passed to the Macro substitution delegate.
The template to process. This template string should contain macros in the form of ${macro_name}.
Processes the specified string.
Syntax
public string Process( 
   T item,
   string template
)
'Declaration
 
Public Function Process( _
   ByVal item As T, _
   ByVal template As String _
) As String
'Usage
 
Dim instance As MacroProcessor(Of T)
Dim item As T
Dim template As String
Dim value As String
 
value = instance.Process(item, template)
public:
String^ Process( 
   T^ item,
   String^ template
) 

Parameters

item
The item to be passed to the Macro substitution delegate.
template
The template to process. This template string should contain macros in the form of ${macro_name}.

Return Value

A string that results from all of the macros being processed in the template.
Example

This example adds two macros to the macro processor and process a string.

Copy Code  
Imports Leadtools.Dicom.Common.Anonymization

<TestMethod()> _
Public Sub MacroProcessorSample()
   Dim processor As New MacroProcessor(Of Object)()
   '
   ' add two macros to the macro processor
   '
   processor.Macros.Add("current_date", New MacroSubsitutionDelegate(Of Object)(AddressOf CurrentDateMacro))
   processor.Macros.Add("current_time", New MacroSubsitutionDelegate(Of Object)(AddressOf CurrentTimeMacro))

   '
   ' Process a macro string
   '
   Console.WriteLine(processor.Process(processor, "${current_date} ==> ${current_time}"))
End Sub

Private Function CurrentDateMacro(ByVal userData As Object, ByVal name As String, ByVal ParamArray parameters As Object()) As String
   Return DateTime.Now.ToShortDateString()
End Function

Private Function CurrentTimeMacro(ByVal userData As Object, ByVal name As String, ByVal ParamArray parameters As Object()) As String
   Return DateTime.Now.ToShortTimeString()
End Function
using Leadtools.Dicom.Common.Anonymization;

[TestMethod]
public void MacroProcessorSample()
{
   MacroProcessor<object> processor = new MacroProcessor<object>();
   //
   // add two macros to the macro processor
   //

   processor.Macros.Add("current_date", new MacroSubsitutionDelegate<object>(CurrentDateMacro));
   processor.Macros.Add("current_time", new MacroSubsitutionDelegate<object>(CurrentTimeMacro));

   //
   // Process a macro string
   //

   Console.WriteLine(processor.Process(processor, "${current_date} ==> ${current_time}"));
}

private string CurrentDateMacro(object userData, string name, params object[] parameters)
{
   return DateTime.Now.ToShortDateString();
}

private string CurrentTimeMacro(object userData, string name, params object[] parameters)
{
   return DateTime.Now.ToShortTimeString();
}
Requirements

Target Platforms

See Also

Reference

MacroProcessor<T> Class
MacroProcessor<T> Members

Error processing SSI file
   Leadtools.Dicom.Common requires a Medical toolkit license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features